#pragma once

#include <QOpenGLWindow>
#include <QMatrix4x4>

class QOpenGLFunctions_3_3_Core;
class QOpenGLBuffer;
class Camera;
class MaterialProg;
class TextureProg;
class LampProg;
struct Light;


class MyGlWindow : public QOpenGLWindow
{
    Q_OBJECT

public:
    MyGlWindow();
    QString contextInformation() const;

    LampProg* lamp() {return lampProg;}
    MaterialProg* material() {return materialProg;}

protected:
    virtual void initializeGL();
    virtual void paintGL();
    virtual void resizeGL(int w, int h);
    virtual void keyPressEvent(QKeyEvent* ev);
    virtual void mouseMoveEvent(QMouseEvent *ev);
    virtual void wheelEvent(QWheelEvent *ev);

private slots:
  void teardownGL();

private:

    QOpenGLFunctions_3_3_Core*  MY_GL_FUNC;
    QOpenGLBuffer*              vbo;

    Camera*                     camera;
    bool                        firstMouse;
    QPoint                      lastMousePos;

    LampProg*                   lampProg;
    MaterialProg*               materialProg;
    TextureProg*                textureProg;
};
